/*
 *接口编写处...
*如果接口需要做Action的权限验证，请在Action上使用属性
*如: [ApiActionPermission("Ads_TimeoutAlert",Enums.ActionPermissionOptions.Search)]
 */
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Http;
using DGZImp.AdsProject.DomainModels;
using DGZImp.AdsProject.IServices;
using DGZImp.Core.Utilities.Response;

namespace DGZImp.AdsProject.Controllers
{
    public partial class Ads_TimeoutAlertController
    {
        private readonly IAds_TimeoutAlertService _service;//访问业务代码
        private readonly IHttpContextAccessor _httpContextAccessor;

        [ActivatorUtilitiesConstructor]
        public Ads_TimeoutAlertController(
            IAds_TimeoutAlertService service,
            IHttpContextAccessor httpContextAccessor
        )
        : base(service)
        {
            _service = service;
            _httpContextAccessor = httpContextAccessor;
        }

        /// <summary>
        /// 通过异常类型获取该超时配置
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet("GetTimeoutAlertByAbnormalId")]
        public async Task<ApiResponse<TimeoutAlertDto>> GetTimeoutAlertByAbnormalId(long id)
        {
            var res = await _service.GetTimeoutAlertByAbnormalId(id);
            return ApiRes.Success(res);
        }
    }
}
